﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogicUniversityBiz
{
    public class MaintainSupplier
    {
        LogicUniversityEntities en = new LogicUniversityEntities();

        public List<Supplier> getSupplierList()
        {
            var supList = en.Suppliers.
                AsEnumerable().
                Select(x => x).
                ToList();
            return supList;
        }

        public IQueryable getSupplierCodeList()
        {
            var y = from x in en.Suppliers
                    select new { x.Supplier_Code, x.Supplier_Name };

            return y;
        }

        public List<Supplier> getOtherInfoBySupplierCode(String supCode)
        {
            List<Supplier> list = new List<Supplier>();
            string sql = "select * from Supplier where Supplier_Code = '"+supCode+"'";
            var issue = en.ExecuteStoreQuery<Supplier>(sql);

            foreach (Supplier t in issue)
                list.Add(t);

            return list;
        }

    }
}
